{template header}

<!--{if $webglobal[mode]=='companyedit'}-->

	<script type="text/javascript" charset="utf-8" src="{WEBURLPATH}/editor/kindeditor-min.js"></script>
	<script type="text/javascript" src="{WEBURLPATH}/javascript/jquery.linkagesel-min.js"></script>
	<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?sensor=false"></script>
	<table class="menutable" cellspacing="1">
		<thead>
			<tr><td>商铺管理</td></tr>
		</thead>
		<tbody>
			<tr><td>
				<a href="{ADMIN_WEBURLPATH}/index.php?mode=company&{$webrequest[gourl]}">[商铺列表]</a>
			</td></tr>
		</tbody>
	</table>

	<form name="editform" method="post" enctype="multipart/form-data" action="{ADMIN_WEBURLPATH}/index.php?mode=companyedit&check&gourl={$webglobal[file_company][gourlencode]}">
	<input type="hidden" name="editid" value="{$webrequest[editid]}" />
	<table class="datatable" cellspacing="1">
		<thead>
			<tr><td colspan="2">修改商铺</td></tr>
		</thead>
		<tbody>
			<tr>
				<th>商铺分类<span class="need"> *</span></th>
				<td>
					<select name="company_category_id">
						<option value="0">选择分类...</option>
						<!--{loop $webglobal[file_company][category] $categoryID $option}-->
						<option value="{$categoryID}">{$option[showName]}</option>
						<!--{/loop}-->
					</select>
					<script type="text/javascript">common_CheckedSelect('company_category_id', '{$webglobal[file_company][editinfo][company_category_id]}');</script>
				</td>
			</tr>
			<tr>
				<th>商铺状态<span class="need"> *</span></th>
				<td>
					<select name="status">
						<option value="999">选择状态...</option>
						<option value="1">审核通过</option>
						<option value="0">待审核</option>
						<option value="-1">已删除</option>
					</select>
					<script type="text/javascript">common_CheckedSelect('status', '{$webglobal[file_company][editinfo][status]}');</script>
				</td>
			</tr>
			<tr>
				<th>明星商铺</th>
				<td>
					<input type="checkbox" name="newstar" id="newstar" value="1"{if $webglobal[file_company][editinfo][newstar]==1} checked="checked"{/if} /><label for="newstar">设为明星商铺</label>
				</td>
			</tr>
			<tr>
				<th>登录用户名<span class="need"> *</span><div>英文或者数字，不能以数字开头，不超过15位</div></th>
				<td>
					<input type="text" name="username" size="70" value="{$webglobal[file_company][editinfo][username]}" />
				</td>
			</tr>
			<tr>
				<th>E-mail<span class="need"> *</span></th>
				<td>
					<input type="text" name="email" size="70" value="{$webglobal[file_company][editinfo][email]}" />
				</td>
			</tr>
			<tr>
				<th>商铺中文名称<span class="need"> *</span></th>
				<td>
					<input type="text" name="name" size="70" value="{$webglobal[file_company][editinfo][name]}" />
				</td>
			</tr>
			<tr>
				<th>商铺英文名称<div>中文和英文必填一项</div></th>
				<td>
					<input type="text" name="english_name" size="70" value="{$webglobal[file_company][editinfo][english_name]}" />
				</td>
			</tr>
			<tr>
				<th>商铺logo<div>格式：jpg,gif,png</div></th>
				<td>
					<input type="file" name="logo" size="40" /><!--{if $webglobal[file_company][editinfo][logo]!=''}-->&nbsp;&nbsp;<img src="{WEBURLPATH}{$webglobal[file_company][editinfo][logo]}" height="50" alt="" border="0" /><input type="checkbox" name="logo_del" id="logo_del" value="1" /><label for="logo_del">删除当前logo图片</label><!--{/if}-->
				</td>
			</tr>
			<tr>
				<th>营业执照</th>
				<td>
					<input type="text" name="bcode" size="70" value="{$webglobal[file_company][editinfo][bcode]}" />
				</td>
			</tr>
			<tr>
				<th>营业执照图片<div>格式：jpg,gif,png</div></th>
				<td>
					<input type="file" name="bcode_image" size="40" /><!--{if $webglobal[file_company][editinfo][bcode_image]!=''}-->&nbsp;&nbsp;<a href="{WEBURLPATH}{$webglobal[file_company][editinfo][bcode_image]}" target="_blank"><img src="{WEBURLPATH}{$webglobal[file_company][editinfo][bcode_image]}" height="50" alt="" border="0" /></a><input type="checkbox" name="bcode_image_del" id="bcode_image_del" value="1" /><label for="bcode_image_del">删除当前营业执照图片</label><!--{/if}-->
				</td>
			</tr>
			<tr>
				<th>所属商圈<span class="need"> *</span></th>
				<td>
					<!-- area_id,province,city,district -->
					<input type="hidden" name="area_id" id="area_id" />
					<select name="area" id="area">
					</select>
					<input type="hidden" name="area_info" id="area_info" value="" />
				</td>
			</tr>
			<tr>
				<th>商铺地址<span class="need"> *</span></th>
				<td>
					<input type="text" name="address" id="address" size="70" value="{$webglobal[file_company][editinfo][address]}" />
				</td>
			</tr>
			<tr>
				<th>商铺电话</th>
				<td>
					<input type="text" name="tel" size="70" value="{$webglobal[file_company][editinfo][tel]}" />
				</td>
			</tr>
			<tr>
				<th>商铺google地图</th>
				<td>
					<!-- latitude 纬度,longitude 经度 -->
					<input type="hidden" name="latitude" id="input_latitude" value="{$webglobal[file_company][editinfo][latitude]}" />
					<input type="hidden" name="longitude" id="input_longitude" value="{$webglobal[file_company][editinfo][longitude]}" />
					<input type="button" value="显示大地图" onclick="show_map('big');" id="show_map_button" />
					<input type="button" value="标注新坐标" onclick="mark_map();" id="mark_map_button" />
					<!--{if $webglobal[file_company][editinfo][latitude]!=0 || $webglobal[file_company][editinfo][longitude]!=0}-->
						&nbsp;&nbsp;<span id="mark_map_info">(已设定 纬度：{$webglobal[file_company][editinfo][latitude]}，经度：{$webglobal[file_company][editinfo][longitude]})</span>
					<!--{/if}-->
					<br /><input type="button" value="清除新坐标" onclick="mark_clear();" id="mark_clear_button" style="display:none;" />
					&nbsp;&nbsp;<span id="mark_map_info_new"></span>
					<div id="map_canvas_edit" style="width:200px; height:100px; display: none;"></div>
					<script type="text/javascript">
						var cur_latitude = {$webglobal[file_company][editinfo][latitude]};
						var cur_longitude = {$webglobal[file_company][editinfo][longitude]};
						var cur_latlng = new google.maps.LatLng({$webglobal[file_company][editinfo][latitude]}, {$webglobal[file_company][editinfo][longitude]});
						var cur_default_latlng = new google.maps.LatLng(35.22354439383212, 103.93229484558105);
						var cur_default_zoom = 4;
						var map;
						var new_marker;
						function map_initialize(latlng, zoom)
						{
							$("#map_canvas_edit").show();
							var myOptions = {
									zoom: zoom,
									center: latlng,
									mapTypeControl: false,
									//navigationControl: false,
									streetViewControl: false,
									mapTypeId: google.maps.MapTypeId.ROADMAP
								};
							map = new google.maps.Map(document.getElementById("map_canvas_edit"), myOptions);
						}
						function show_map(type)
						{
							if (type == 'big') {
								$("#map_canvas_edit").width(600).height(400);
							}
							if (cur_latitude!=0 || cur_longitude!=0)
							{
								map_initialize(cur_latlng, 16);
								var cur_marker = new google.maps.Marker({map: map, position: cur_latlng, icon: WEBURLPATH+'/images/mapflag.png'});
							}
						}
						function mark_map()
						{
							$("#map_canvas_edit").width(600).height(400);
							map_initialize(cur_default_latlng, cur_default_zoom);
							codeAddress();
							google.maps.event.addListener(map, 'click', function(event){addMarker(event.latLng);});
							mark_clear();
							$("#mark_map_info_new").html('(点击地图设定新坐标)');
						}
						function addMarker(location)
						{
							if (new_marker)
							{
								new_marker.setMap(null);
							}
							var new_latitude = location.lat();
							var new_longitude = location.lng();
							new_marker = new google.maps.Marker({position: location,map: map});
							$("#input_latitude").val(new_latitude);
							$("#input_longitude").val(new_longitude);
							$("#mark_clear_button").show();
							$("#mark_map_info_new").html('(新坐标 纬度：'+new_latitude+'，经度：'+new_longitude+')');
						}
						function mark_clear()
						{
							if (new_marker)
							{
								new_marker.setMap(null);
							}
							$("#input_latitude").val(cur_latitude);
							$("#input_longitude").val(cur_longitude);
							$("#mark_clear_button").hide();
							$("#mark_map_info_new").html('');
						}
						function codeAddress() {
							var address = '';
							if ($('#address').val() != '') {
								address = $('#address').val();
							} else {
								address = $('#area_info').val();
							}
							if (address == '') {
								return;
							}
							var geocoder = new google.maps.Geocoder();
							geocoder.geocode({'address': address}, function(results, status) {
								if (status == google.maps.GeocoderStatus.OK)
								{
									map.setCenter(results[0].geometry.location);
									map.setZoom(16);
									var search_marker = new google.maps.Marker({
													map: map, 
													position: results[0].geometry.location,
													icon: WEBURLPATH+'/images/mapflag.png'
												});
									var infowindow = new google.maps.InfoWindow({maxWidth: 200, content: '系统根据当前地址模糊定位到此，请点击地图设定确切位置，只有点击后设定才生效，当前标记仅作参考。'});
									infowindow.open(map, search_marker);
								}
							});
						}
						$(document).ready(show_map('small'));
					</script>
					<!-- http://code.google.com/intl/zh-CN/apis/maps/documentation/javascript/reference.html -->
				</td>
			</tr>
			<tr>
				<th>商铺网址</th>
				<td>
					<input type="text" name="site" size="70" value="{$webglobal[file_company][editinfo][site]}" />
				</td>
			</tr>
			<tr>
				<th>商铺介绍<span class="need"> *</span></th>
				<td>
					<script>
						KE.show({
							id : 'description',
							items : ['source', '|', 'undo', 'redo', 'cut', 'copy', 'paste',
									'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
									'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
									'superscript', '|', 'selectall', 'fullscreen', '-',
									'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
									'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image',
									'flash', 'media', 'advtable', '|', 'link', 'unlink', '|', 'pagebreak'],
							imageUploadJson : '{WEBURLPATH}/editor/editorup.php?upfrom=company',
							resizeMode : 1
						});
					</script>
					<textarea id="description" name="description" style="width:100%;height:300px;">{$webglobal[file_company][editinfo][description]}</textarea>
				</td>
			</tr>
			<tr>
				<th>其他信息</th>
				<td>
					添加时间：{$webglobal[file_company][editinfo][addtime_show]}，登录IP：{$webglobal[file_company][editinfo][loginip]}，登录时间：{$webglobal[file_company][editinfo][logintime_show]}。<br />
					企业评分：{$webglobal[file_company][editinfo][score]}，评论总次数：{$webglobal[file_company][editinfo][comment_total_time]}，评论总积分：{$webglobal[file_company][editinfo][comment_total_score]}，收藏次数：{$webglobal[file_company][editinfo][favorites_num]}。
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr><td colspan="2">
				<input type="submit" name="adminsubmit" class="submitok" value=" 确  认 " />&nbsp;&nbsp;
				<input type="reset" name="adminreset" value=" 取  消 " />
			</td></tr>
		</tfoot>
	</table>
	</form>
	<script type="text/javascript">
		$(document).ready(function(){
			var areaData = '{$webglobal[file_company][editinfo][area_json]}';
			var areaData = eval('(' + areaData + ')');
			var opts = {
					data: areaData,
					selStyle: 'margin-left: 3px;',
					select: ['#area'],
					defVal: [{$webglobal[file_company][editinfo][area_tree]}]
			};
			var linkageSel = new LinkageSel(opts);
			areaData = opts = null; // 如果数据量大最好在创建LinkageSel实例之后清空

			linkageSel.onChange(function() {
				var input = $('#area_id');
				var lastselect = linkageSel.getSelectedValue();
				input.val(lastselect);
				var input1 = $('#area_info'),
					d = this.getSelectedDataArr('name'),
					arr = [];
				for (var i = 0, len = d.length; i < len; i++) {
					arr.push(d[i]);
				}
				input1.val(arr.join(''));
			});
		});
	</script>
<!--{elseif $webglobal[mode]=='companyfp'}-->

	<form name="searchform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=companyfp">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<td colspan="3">搜索找回密码申请</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th style="width: 100px;">搜索选项</th>
				<td>
					<select name="status">
						<option value="999">-- 全部状态 --</option>
						<option value="0">待审核</option>
						<option value="1">审核通过</option>
						<option value="2">已拒绝</option>
					</select>
					<script type="text/javascript">
						common_CheckedSelect('status', '{$webglobal[CPP][status]}');
					</script>
					<input type="text" name="searchkey" value="$webglobal[CPP][searchkey]" size="50" />
				</td>
				<td style="width: 100px; text-align: center"><input type="submit" name="searchsubmit" value=" 搜  索 " /></td>
			</tr>
		</tbody>
	</table>
	</form>

	<form name="editform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=companyfp&check&gourl={$webglobal[file_company][gourlencode]}">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<th width="5%"></th>
				<th width="15%">审核状态</th>
				<th width="5%">编号</th>
				<th width="30%">公司名</th>
				<th width="30%">申请原因</th>
				<th width="15%">申请时间</th>
			</tr>
		</thead>
		<tbody>
			<!--{if $webglobal[file_company][datanum]>0}-->
				<!--{loop $webglobal[file_company][dataarray] $tempkey $temptable}-->
					<tr>
						<td{$temptable[tdclass]}><input type="checkbox" name="delid[]" value="{$tempkey}" /></td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[status]==1}-->
								<span class="green">审核通过</span>
							<!--{elseif $temptable[status]==2}-->
								<span class="dark">已拒绝</span>
							<!--{else}-->
								待审核<br />
								<input type="radio" name="auditid[{$tempkey}]" id="auditid_{$tempkey}}_1" value="1" /><label for="auditid_{$tempkey}}_1">通过</label>
								<input type="radio" name="auditid[{$tempkey}]" id="auditid_{$tempkey}}_2" value="2" /><label for="auditid_{$tempkey}}_2">拒绝</label>
							<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>$temptable[id]</td>
						<td{$temptable[tdclass]}>{$temptable[c_name]}<!--{if $temptable[c_english_name]!=''}-->({$temptable[c_english_name]})<!--{/if}--></td>
						<td{$temptable[tdclass]}>{$temptable[reason]}</td>
						<td{$temptable[tdclass]}>$temptable[addtime_show]</td>
					</tr>
				<!--{/loop}-->
			<!--{else}-->
				<tr><td colspan="10" style="text-align: center">还没有找回密码申请。</td></tr>
			<!--{/if}-->
		</tbody>
	</table>

	<!--{if $webglobal[file_company][datanum]>0}-->
		<table style="width:100%;border-style:none;" cellpadding="0" cellspacing="0">
			<tr>
				<td style="width:80px;margin:0;padding:0;"><input type="submit" name="adminsubmit" value=" 批量更改 " /></td>
				<td style="text-align:right;margin:0;padding:5px 0;">{template page}</td>
			</tr>
		</table>
	<!--{/if}-->
	</form>

<!--{elseif $webglobal[mode]=='company'}-->

	<form name="searchform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=company">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<td colspan="3">搜索商铺</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th style="width: 100px;">搜索选项</th>
				<td>
					<select name="class">
						<option value="0">-- 全部分类 --</option>
						<!--{loop $webglobal[file_company][category] $categoryID $option}-->
							<option value="{$categoryID}">{$option[showName]}</option>
						<!--{/loop}-->
					</select>
					<select name="status">
						<option value="999">-- 全部状态 --</option>
						<option value="1">审核通过</option>
						<option value="0">待审核</option>
						<option value="-1">已删除</option>
					</select>
					<select name="city">
						<option value="0">-- 全部城市 --</option>
						<!--{loop $webglobal[file_company][citydata] $categoryID $option}-->
							<option value="{$categoryID}">{$option[name]}</option>
						<!--{/loop}-->
					</select>
					<script type="text/javascript">
						common_CheckedSelect('class', '{$webglobal[CPP][class]}');
						common_CheckedSelect('status', '{$webglobal[CPP][status]}');
						common_CheckedSelect('city', '{$webglobal[CPP][city]}');
					</script>
					<input type="text" name="searchkey" value="$webglobal[CPP][searchkey]" size="50" />
				</td>
				<td style="width: 100px; text-align: center"><input type="submit" name="searchsubmit" value=" 搜  索 " /></td>
			</tr>
		</tbody>
	</table>
	</form>

	<form id="companydel" name="editform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=companyup&check&gourl={$webglobal[file_company][gourlencode]}">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<th width="7%"></th>
				<th width="10%">审核状态</th>
				<th width="5%"><a href="{ADMIN_WEBURLPATH}/index.php?mode=company&order=id{$webglobal[file_company][searchurl]}" class="special" title="点击按此排序">编号<!--{if $webglobal[CPP][order]=='id'}-->↓<!--{/if}--></a></th>
				<th width="5%">分类</th>
				<th width="5%">明星</th>
				<th width="10%">标志</th>
				<th width="20%">商铺详情</th>
				<th width="20%">登录信息</th>
				<th width="10%"><a href="{ADMIN_WEBURLPATH}/index.php?mode=company&order=addtime{$webglobal[file_company][searchurl]}" class="special" title="点击按此排序">添加时间<!--{if $webglobal[CPP][order]=='addtime'}-->↓<!--{/if}--></a></th>
				<th width="10%">管理</th>
			</tr>
		</thead>
		<tbody>
			<!--{if $webglobal[file_company][datanum]>0}-->
				<!--{loop $webglobal[file_company][dataarray] $tempkey $temptable}-->
					<tr>
						<td{$temptable[tdclass]}><!--{if $temptable[status]!=-1}--><input type="checkbox" name="delid[]" value="{$tempkey}" class="selectUnit" /><!--{/if}--></td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[status]==1}-->
								<span class="green">审核通过</span>
							<!--{elseif $temptable[status]==-1}-->
								<span class="dark">已删除</span>
							<!--{else}-->
								<input type="checkbox" name="auditid[]" value="{$tempkey}" />待审核
							<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>$temptable[id]</td>
						<td{$temptable[tdclass]}>{$webglobal[file_company][category][$temptable[company_category_id]][name]}</td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[newstar]>0}--><span class="green">是</span><!--{else}-->否<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[logo]!=''}--><img src="{WEBURLPATH}{$temptable[logo]}" width="80" alt="" /><!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							名称：{$temptable[name]}<br />
							英文：{$temptable[english_name]}<br />
							营业执照：<a href="{WEBURLPATH}{$temptable[bcode_image]}" target="_blank">{$temptable[bcode]}</a><br />
							所属商圈：{$webglobal[file_company][areadata][$temptable[city]][name]}<!--{if $temptable[district]>0}--> - {$webglobal[file_company][areadata][$temptable[district]][name]}<!--{/if}--><!--{if $temptable[area_id]>0}--> - {$webglobal[file_company][areadata][$temptable[area_id]][name]}<!--{/if}--><br />
							商铺地址：{$temptable[address]}<br />
							商铺电话：{$temptable[tel]}<br />
						</td>
						<td{$temptable[tdclass]}>
							用户名：{$temptable[username]}<br />
							E-mail：{$temptable[email]}<br />
							登录IP：{$temptable[loginip]}<br />
							登录时间：{$temptable[logintime_show]}<br />
						</td>
						<td{$temptable[tdclass]}>$temptable[addtime_show]</td>
						<td{$temptable[tdclass]}>
							<a href="{ADMIN_WEBURLPATH}/index.php?mode=companyedit&editid={$tempkey}&gourl={$webglobal[file_company][gourlencode]}" class="special">[编辑]</a>
							<!--{if $temptable[status]==-1}-->
								&nbsp;<!-- <a href="javascript:common_ConfirmGoUrl('确定要从数据库中删除该商铺么？','{ADMIN_WEBURLPATH}/index.php?mode=companydel&id={$tempkey}&gourl={$webglobal[file_company][gourlencode]}')" class="special">[删除]</a> -->
							<!--{/if}-->
						</td>
					</tr>
				<!--{/loop}-->
			<!--{else}-->
				<tr><td colspan="10" style="text-align: center">还没有商铺。</td></tr>
			<!--{/if}-->
		</tbody>
	</table>

	<!--{if $webglobal[file_company][datanum]>0}-->
		<input type="hidden" name="access" id="access" value="update">
		<table style="width:100%;border-style:none;" cellpadding="0" cellspacing="0">
			<tr>
				<td>
				<input onclick="selectallbutton()" type="button" value="全选">
				<input type="button" onclick="checkdel()" name="deletesubmit" id="deletesubmit" value=" 批量删除 " />
				<input type="submit" name="adminsubmit" value=" 批量审核 " id="updatesubmit" />
				<input id ="selecthidden" type="hidden" value="0" />
				</td>
				<td style="text-align:right;margin:0;padding:5px 0;">{template page}</td>
			</tr>
		</table>
	<!--{/if}-->
	</form>
	<script type="text/javascript">
		function checkdel(){
			if(confirm('确认删除？')){
				$('#deletesubmit').submit();
			}
		}
		function selectallbutton() {
			if($('#selecthidden').val()==0){
				$('#selecthidden').val('1');
			}else{
				$('#selecthidden').val('0');
			}
			$('.selectUnit').each(function(){
				if($('#selecthidden').val()=='1'){
					$(this).attr('checked',true);
				}else{
					$(this).attr('checked',false);
				}
			});
		}
		
	$(document).ready(function(){
		function selectall() {
			$('.selectUnit').each(function(){
				if($('.selectAll').attr('checked')){
					$(this).attr('checked',true);
				}else{
					$(this).attr('checked',false);
				}
			});
		}
		$('.selectAll').bind('click', selectall);
		$('#deletesubmit').click(function(){
			$('#access').val('delete');
		});
		$('#updatesubmit').click(function(){
			$('#access').val('update');
		});
	});
	</script>
<!--{/if}-->

{template footer}